{include file="common/head"/}
<div class="admin-main layui-anim layui-anim-upbit">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>{:lang('adminMenu')}</legend>
    </fieldset>
    <blockquote class="layui-elem-quote">
        <a href="{:url('menuadd')}" class="layui-btn layui-btn-sm">{:lang('add')}栏目</a>
    </blockquote>
    <table class="layui-table">
        <thead>
        <tr>
            <th>{:lang('order')}</th>
            <th>编号</th>
            <th>名称<span id="cateNameMsg"></span></th>
            <th>URL</th>
            <th>图标</th>
            <th>类型</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody id="con">
        {$categorys|raw}
        <!-- {volist name='categorys' id='vo'}
        {$vo|raw} -->
        <!-- <tr>
            <td>{$vo.sort}</td>
            <td>{$vo.id}</td>
            <td>{$vo.title}</td>
            <td>{$vo.href}</td>
            <td>{$vo.status}</td>
            <td>{$vo.str_manage|raw}</td>
        </tr> -->
        <!-- {/volist} -->
        </tbody>
        <tfoot>
    </table>
</div>
{include file="common/foot"/}
<script src="__PUBLIC__/static/common/js/jquery.2.1.1.min.js"></script>
<script>
    var layer;
    layui.use('table', function(){
        var $= layui.jquery,layer= layui.layer;
        $('body').on('blur','.list_order',function() {
            var id = $(this).attr('data-id');
            var sort = $(this).val();
			console.log(sort)
            var loading = layer.load(1, {shade: [0.1, '#fff']});
            $.post('{:url("modOrder")}',{id:id,sort:sort},function(res){
			    console.log(res)
                layer.close(loading);
                if(res.code === 1){
                    layer.msg(res.msg, {time: 1000, icon: 1}, function () {
                        location.href = res.url;
                    });
                }else{
                    layer.msg(res.msg,{time:1000,icon:2});
                }
            })
        });
    });
    function del(id) {
        layer.confirm('你确定要删除该栏目及其子栏目吗？', {icon: 3}, function (index) {
            $.post('{:url("menudel")}', {id: id}, function (data) {
                if (data.status === 1) {
                    layer.alert(data.info, {icon: 6}, function(index){
                        layer.close(index);
                        window.location.href=data.url;
                    });
                }else{
                    layer.msg(data.info,{icon:5});
                }
            });
            layer.close(index);
        });
    }
</script>
</body>
</html>